// +FHDR------------------------------------------------------------
//                 Copyright (c) 2022 .
//                       ALL RIGHTS RESERVED
// -----------------------------------------------------------------
// Filename      : apb_env.sv
// Author        : 
// Created On    : 2022-08-25 17:45
// Last Modified : 
// -----------------------------------------------------------------
// Description:
//
//
// -FHDR------------------------------------------------------------

`ifndef __APB_ENV_SV__
`define __APB_ENV_SV__

class apb_env extends uvm_env;
	
	apb_agent agt;
    apb_scb   scb;

	extern function new(string name = "apb_env", uvm_component parent=null);
	extern virtual function void build_phase(uvm_phase phase);
    extern virtual function void connect_phase(uvm_phase phase);
	
	`uvm_component_utils(apb_env)
endclass: apb_env

function apb_env::new(string name = "apb_env", uvm_component parent=null);
	super.new(name, parent);
endfunction: new

function void apb_env::build_phase(uvm_phase phase);
	super.build_phase(phase);
	agt = apb_agent::type_id::create("agt", this);
    scb = apb_scb::type_id::create("scb", this);
	agt.is_active = UVM_ACTIVE;
    agt.rdy_en = 1;
endfunction: build_phase

function void apb_env::connect_phase(uvm_phase phase);
   super.connect_phase(phase);
   scb.exp_port.connect(agt.drv_out_fifo.blocking_get_export);
   scb.act_port.connect(agt.out_fifo.blocking_get_export);
endfunction

`endif
